<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function* add(q) {
            const content = yield console.log('执行3')
            console.log(content)

            yield console.log('执行1')
            const name = yield console.log('执行2')
            console.log(name)

            yield console.log('执行4')
        }

        const myGen = add()
        myGen.next('111')
            // myGen.next('888')
            // myGen.next()
            // myGen.next('999')
            // myGen.next()
    </script>
</body>

</html>